package win.larryzeal.redisdemo.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import win.larryzeal.redisdemo.pojo.City;
import win.larryzeal.redisdemo.pojo.Country;
import win.larryzeal.redisdemo.service.RedisCacheUtil;

import java.util.Map;

/**
 * Created by 张少昆 on 2017/1/5.
 */
@Controller
public class TestController {
	@Autowired
	private RedisCacheUtil<Object> redisCacheUtil;

	@RequestMapping( "testGetCache" )
	public void testGetCache(){
		Map<Integer, Country> countryMap = redisCacheUtil.getCacheIntegerMap("countryMap");
		Map<Integer, City> cityMap = redisCacheUtil.getCacheIntegerMap("cityMap");

		for(int key : countryMap.keySet()){
			System.out.println("key = " + key + ",value=" + countryMap.get(key));
		}

		System.out.println("------------city");
		for(int key : cityMap.keySet()){
			System.out.println("key = " + key + ",value=" + cityMap.get(key));
		}
	}
}
